import { SideTheme } from '@/store/types'
import { generate, getRgbStr } from '@arco-design/color'
import useAppConfigStore from '@/store/modules/app-config'

export default function (color: string) {
  if (!color) return
  const appStore = useAppConfigStore()
  const list = generate(color, { list: true, dark: appStore.theme === SideTheme.DARK })
  list.forEach((color: string, index: number) => {
    const rgbStr = getRgbStr(color)
    document.body.style.setProperty(`--primary-${index + 1}`, rgbStr)
  })
}
